/*
 * @Author: 吴世扬 18368095041@163.com
 * @Date: 2025-02-19 09:43:57
 * @LastEditors: 吴世扬 18368095041@163.com
 * @LastEditTime: 2025-02-21 09:52:52
 * @FilePath: /vue3-admin-server/src/common/dto/menu.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { IsNotEmpty, IsNumber, IsString, IsBoolean } from 'class-validator';

import { DeptEntity } from 'src/entities/dept.entity';

import { PageDTO } from './page';

export class DeptListDTO extends PageDTO<DeptEntity> {
    @IsString({ message: '部门名称必须为字符串' })
    name?: string;

    @IsNumber(undefined, {
        message: '部门父级id必须为数字'
    })
    parentId?: number;

    @IsNumber(undefined, {
        message: '部门等级必须为数字'
    })
    level?: number;

    @IsBoolean({
        message: '部门是否有效必须为布尔值'
    })
    valid?: boolean;
}

export class DeptDTO {
    @IsNumber(undefined, {
        message: '部门id必须为数字'
    })
    id?: number;

    @IsNotEmpty({ message: '部门名称不能为空' })
    @IsString({ message: '部门名称必须为字符串' })
    name: string;

    @IsNumber(undefined, {
        message: '部门父级id必须为数字'
    })
    parentId?: number;

    @IsBoolean({ message: '状态必须为布尔值' })
    @IsNotEmpty({ message: '部门名称不能为空' })
    valid: boolean;
}
